package com.palmshop.online.service.impl;

import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.palmshop.online.dao.GoodsDao;
import com.palmshop.online.entity.PalmResult;
import com.palmshop.online.service.GoodsService;

/**
 * 商品service实现类
 * @author quan
 *
 */
@Service
@Transactional
public class GoodsServiceImpl implements GoodsService {

	@Resource
	private GoodsDao dao;

	/**
	 * 根据商铺的标识查询出该店铺的商品分类
	 * @param shopUnique：店铺唯一性标识
	 * @return result
	 */
	public PalmResult findGoodsKind(String shopUnique){
		PalmResult result =new PalmResult();
		List<Map<String,Object>>list=dao.findGoodsKind(shopUnique);
		if(list!=null&&list.size()>0){
			result.setStatus(1);
			result.setData(list);
		}
		return result;
	}
	
	/**
	 * 根据商品id查询商品的对应信息
	 * 
	 * @param goodsId
	 *            ：商品id
	 * @return result
	 */
	public PalmResult findGoodsById(Integer goodsId) {
		PalmResult result = new PalmResult();
		//dao.updateGoodsHits(goodsId);
		Map<String, Object> map = dao.findGoodsById(goodsId);
		if (map != null) {
			result.setStatus(1);
			result.setData(map);
		}
		return result;
	}

}














